Software Development
Unit Testing in Python
Final Exam: Python Journeyman
Python Unit Testing: Advanced Python Testing Using the unittest Framework
Python Unit Testing: An Introduction to Python's unittest Framework
Python Unit Testing: Testing Python Code Using doctest
Python Unit Testing: Testing Python Code Using pytest

Final Exam: Python Journeyman

Course Number:
it_fepnp_03_enus
Lesson Objectives

Final Exam: Python Journeyman

  • configure a route in your Flask app so that POST requests can be submitted to it
  • convey the invocation of an operation to end-users using message flashing
  • create a condition instance that will have multiple threads waiting for data to be generated
  • create and execute a coroutine using the asyncio module
  • create a pool of processes to which tasks can be submitted
  • create a readme file for a Python module which bundles documentation and testing in a single file
  • define and execute multiple tests within a single test case
  • define a route that renders an HTML page when a URL is accessed
  • define a script testing out multiple functions in the source using the PyCharm IDE
  • define, initialize, and execute a process in Python
  • describe multithreading and compare its performance with sequential execution of tasks
  • describe the different types of Queue objects available in Python
  • describe the implementation of threads and processes in the Python language
  • describe the steps involved in a web request and the role of web applications in the process
  • distinguish between multiprocessing and multithreading in the context of sharing data in memory
  • download, install and configure the PyCharm IDE
  • execute queries against tables using an SQLAlchemy model
  • execute tests defined in multiple scripts using pytest
  • execute two threads concurrently to save time relative to a sequential execution
  • generate hashes of passwords using the Bcrypt package
  • generate URLs dynamically using the url_for function
  • handle successful and unsuccessful HTTP requests according to the status code of the response
  • identify the specific use cases for multithreading
  • implement producer and consumer threads that add to and remove from a queue
  • initialize and execute a thread in Python
  • install Flask in a virtual environment on your development machine
  • install SQL Alchemy and use it to connect the Flask application to an SQLite database
  • install the latest version of Python and write a test using the unittest framework
  • install the Python Requests package and set up a workspace
  • invoke PUT, OPTIONS, and DELETE requests and recognize the specific use case for each of them
  • make a GET request and explore the response object returned
  • make a GET request and explore the response object returned, which includes a status code and headers
  • modify the boilerplate CSS and HTML definitions to customize the look of a web site
  • pick the tests to execute based on the test function names
  • recall the features of the Flask framework that are available either out of the box or via extensions
  • recognize the conditions under which a deadlock may occur
  • recognize the various pieces that can make up web applications and the role of web frameworks in defining them
  • recognize what a race condition is and when it can occur with concurrent programming
  • recognize what sequential execution is and what its limitations are
  • recognize when a test script will benefit from the use of fixture functions
  • recognize where doctests can be placed within source code
  • retrieve metadata for a resource using a HEAD request
  • return a custom error page whenever a 404 error is invoked on your web site
  • select the tests to execute based on the test function names
  • serve a custom error page whenever a 404 error is invoked on your web site
  • set a name for a thread and ensure a thread waits for a created thread to complete
  • stop the execution of tests when there are a specific number of test failures
  • summarize how semaphores can restrict the number of concurrent tasks accessing a shared resource
  • use SQL Alchemy to generate relational database tables for each model defined in your application
  • use the Bcrypt package to generate hashes of passwords so that they can be stored securely
  • use the different decorators available in unittest to conditionally and unconditionally skip specific tests
  • use the Flask debugger to record information in your application's log
  • use the map function of multithreading. Pool instance to submit multiple tasks to a process pool
  • use the Requests package to construct a POST request that includes a set of key-value pairs to be submitted to a server
  • use the run, create_task, and gather functions in the asyncio modules to execute tasks
  • use the setUp and tearDown functions to define common operations for tests in a script
  • using an SQLAlchemy model, execute queries against tables
  • write and execute a test using pytest
  • write and execute a test using the doctest module
  • write the code for a simple "Hello World" web site using Flask

Overview/Description

This final exam will test your understanding and application of the skills covered in the Python Journeyman track of the Python Novice to Pythonista Aspire Journey.



Target

Prerequisites: none

Python Unit Testing: Advanced Python Testing Using the unittest Framework

Course Number:
it_pyutpydj_02_enus
Lesson Objectives

Python Unit Testing: Advanced Python Testing Using the unittest Framework

  • discover the key concepts covered in this course
  • recognize when a test script will benefit from the use of fixture functions
  • use the setUp and tearDown functions to define common operations for tests in a script
  • apply the setUpClass and tearDownClass functions in a Python test script
  • group test cases into a test suite and execute them using a test runner
  • use the makeSuite function to initialize a test suite
  • download, install and configure the PyCharm IDE
  • create a script which uses the unittest framework by using the PyCharm IDE
  • define a script testing out multiple functions in the source using the PyCharm IDE
  • summarize the key concepts covered in this course

Overview/Description

Discover some of the more advanced features of the Python unittest framework such as the use of fixture functions for common operations across tests, the definition and execution of test suites, and the simplification of writing test scripts using the PyCharm IDE.



Target

Prerequisites: none

Python Unit Testing: An Introduction to Python's unittest Framework

Course Number:
it_pyutpydj_01_enus
Lesson Objectives

Python Unit Testing: An Introduction to Python's unittest Framework

  • discover the key concepts covered in this course
  • install the latest version of Python and write a test using the unittest framework
  • define and execute multiple tests within a single test case
  • recognize the effect of the test names on the execution of test methods
  • pick individual tests from a script which need to be executed
  • identify the various assert functions available in unittest and their specific use cases
  • use the different decorators available in unittest to conditionally and unconditionally skip specific tests
  • summarize the key concepts covered in this course

Overview/Description

The unittest framework (also known as PyUnit) is modeled on JUnit and simplifies the automation of tests for your Python applications. Discover the basic features of unittest such as the definition and execution of test cases and the selection of specific tests for an execution.



Target

Prerequisites: none

Python Unit Testing: Testing Python Code Using doctest

Course Number:
it_pyutpydj_04_enus
Lesson Objectives

Python Unit Testing: Testing Python Code Using doctest

  • discover the key concepts covered in this course
  • write and execute a test using the doctest module
  • recognize where doctests can be placed within source code
  • create a readme file for a Python module which bundles documentation and testing in a single file
  • use the ELLIPSIS directive to account for unpredictable output in doctests
  • use the ELLIPSIS directive to check if the code raises exceptions for incorrect input values
  • recall how to set doctest to ignore whitespace in the output of tests tests
  • summarize the key concepts covered in this course

Overview/Description

The doctest module allows the definition of simple python tests within the docstrings in your source code. Discover the different ways in which doctests can be defined within your source code, and in your source documentation.



Target

Prerequisites: none

Python Unit Testing: Testing Python Code Using pytest

Course Number:
it_pyutpydj_03_enus
Lesson Objectives

Python Unit Testing: Testing Python Code Using pytest

  • discover the key concepts covered in this course
  • write and execute a test using pytest
  • execute tests defined in multiple scripts using pytest
  • pick the tests to execute based on the test function names
  • stop the execution of tests when there are a specific number of test failures
  • apply markers to tests and run only those tests which contain specific marker, and skip the execution of specific tests unconditionally
  • debug test scripts using the python debugger
  • parametrize calls to a function an application using the pytest parametrize decorator
  • use fixtures to define common operations for test functions
  • apply module and function level scopes for fixtures functions
  • bundle fixture functions which are shared across scripts within a single conftest.py file
  • summarize the key concepts covered in this course

Overview/Description

The pytest module simplifies the definition and execution of unit tests and functional tests for Python code. Discover basic unit testing using asserts as well as the streamlining of tests using fixtures.



Target

Prerequisites: none

Close Chat Live